<template>
    <mescroll-uni
        ref="mescrollRef"
        @init="mescrollInit"
        :height="height"
        :down="downOption"
        @down="downRefresh"
        :up="upOption"
        @up="getData">
        <select-staff-list-item
            v-for="(item, index) in datas"
            :item="item"
            :key="index"
            @click.native="selectFn(item)"></select-staff-list-item>
    </mescroll-uni>
</template>

<script>
import selectStaffListItem from "@/pages_supplier/components/select/select-staff-list-item.vue"
import { GetDisPersonnel } from "@/pages_supplier/service/api/store.js"
export default {
    components: {
        selectStaffListItem,
    },
    props: {
        height: {
            type: String,
            default: "300px",
        },
    },
    data() {
        return {
            datas: [],
            allLength: 0,
            data: [],
            productList: [],
            param: {},
            downOption: {
                use: true,
            },
            isLoaded: false,
        }
    },
    mounted() {
        this.refresh()
    },
    methods: {
        //获取列表数据
        getData(page) {
            GetDisPersonnel({ joinPosition: 1 }).then((res) => {
                if (res.State == 1) {
                    this.mescroll.endBySize(res.Data.length, res.RecordAmout)
                    this.datas = this.datas.concat(res.Data)
                } else {
                    this.mescroll.endBySize(0, 0)
                    this.easyToast(res.Msg)
                }
            })
        },
        //获取列表数据

        //刷新
        refresh() {
            this.downRefresh()
        },
        //刷新
        downRefresh() {
            this.datas = []
            this.mescroll.resetUpScroll()
        },
        selectFn(item) {
            this.$emit("selectFn", item, 1)
        },
    },
}
</script>

<style lang="scss">
.list-footer {
    height: 60rpx;
}
</style>
